@extends('home.home')
@section('title',$title)
@section('content')
    <!--content-->
    <head>
    	<style>
        input[class*="info-"] { width: 250px; height: 30px;text-align: center;}
        a {color: white}
        a:hover{ text-decoration: none;color: white; }
        .sign :hover {background: rgb(239,95,33);display: block;border-radius: 30%;} 
    	</style>
    </head>
<div class=" container" >
<div class=" register">
	<h1>个人中心</h1>
	   @if(session('info'))
	   	<p style="color: gold;" class="edit">{{session('info')}}</p>
	   @endif
	    @if (count($errors) > 0)
        <div class="alert alert-danger">
            <ul>
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
        @endif
		  	  <form action="{{url('/home/index/edit')}}" method="post" name="myform-2" enctype="multipart/form-data"> 
		  	  {{csrf_field()}}
				 <div class="col-md-6 register-bottom-grid">
					<h3>个人信息修改</h3>
					 
					 <div >
						<span>安全邮箱</span>
						<input type="text" name="email" value="" class="info-2"> 
					 </div>
					
					 <div> 
					 </div>
					 <div >

						 <span>收货地址</span>
						 <select name="one" id="one">
		
					     </select>
					     <select name="two" id="two">
					     	
					     </select><br>
						 <input type="text" name="addr" value="" class="info-3"> 
					 </div>
					   <div >
						 <span>头像</span>
						 <input type="file" name="uface" value="" class="info-4"> 
					 </div>
					 <div style="height: 20px;"></div>
					  <input type="submit" value="修改">
					  
					 </div>
				     <div class="col-md-6 register-bottom-grid">
				     <h3>个人信息浏览</h3>

						    <div style="width: 500px;height: 200px;text-align: center;position: relative;">
						    	<div style="width: 100px;height: 100px; "><img src="{{asset($data->uface)}}" width="100px" height="100px;" style="border-radius: 50%;position: absolute;left: 200px;"></div>
						    	<p>安全邮箱:{{$data -> email}}</p>
						    	<p>收货地址:{{$data -> addr}}</p>
						    	<span style="display: block;border: 1px solid silver"></span>

						    	<span class="sign" style="display: block;background: silver;width: 50px;height: 50px;text-align: center;line-height: 50px;border-radius:30%;margin-top: 10px;color: white;box-shadow: 0px 0px 3px 3px  black "><a href="{{url('/home/index/sign')}}">签到</a></span>

						    	<span style="width: 150px;height: 50px;margin-left: 50px;margin-top:-50px;text-align: center;line-height: 50px;font-size: 20px;">已经签
						    	@if($sign == null )
						    	0
						    	@else{{$sign->num}}@endif到天</span>
						       

							    <span class="sign" style="display: block;background: silver;width: 50px;height: 50px;text-align: center;line-height: 50px;border-radius:30%;margin-top: -50px;margin-left:300px ;color: white;box-shadow: 0px 0px 3px 3px  black "><a href="{{url('/home/index/draw')}}">抽奖</a></span>

                                @if(!empty($sign))
                                @if($sign->num >= 20)
						    	<span style="width: 160px;height: 50px;margin-left: 50px;margin-top:-50px;margin-left:350px;text-align: center;line-height: 50px;font-size: 20px;">你抽到了
						    	@if(session('draw'))
						    	@if(session('draw') == 4)
                                空@else
                                {{session('draw')}}等
						    	@endif    
						    	@endif奖</span>
						    	@else
						    	<span style="width: 160px;height: 50px;margin-left: 50px;margin-top:-50px;margin-left:350px;text-align: center;line-height: 50px;font-size: 20px;">请坚持签到哦！</span>
						        @endif
						        @endif
						          @if(session('sign'))
								   	<p style="color: red;" class="edit">{{session('sign')}}</p>
							    @endif
						    </div>
    
					 </div>
					 <div class="clearfix"> </div>
				</form>
			
			</div>
			<hr/>
		   <h3>我的订单</h3>
		   @foreach($order as $row)
		   <div class="col-md-12 register-bottom-grid" style="border:1px solid silver;padding: 0 0 0 ;margin-bottom: 10px;" >
		   	<div class="col-md-12 register-bottom-grid" style="background:rgb(245,245,245); height: 50px;margin: 0 0 0 0 ;line-height: 50px;">
		   		<span class="col-md-2 register-bottom-grid">{{$row->otime}}</span><span class="col-md-4 register-bottom-grid">订单号:{{$row->oo}}</span>
		   	</div>
		   	@foreach($row -> oid  as $ww)
		   	<div class="col-md-12 register-bottom-grid" style="height: 100px;position: relative;">
		   		<div class="col-md-2 register-bottom-grid" style="border: 1px solid silver;width:100px;height: 100px;padding: 0 0 0 0;">
		   			<img src="{{asset($ww->gid->gpic)}}" width="100%" height="100px;">
		   		</div>
		   		<div class="col-md-4 register-bottom-grid" style="height: 100px;margin-left:120px;">
                         <span>商品名:{{$ww->gid->gname}}</span>
                         <span>单价:{{$ww->buyprice}}</span>
                         <span>数量：{{$ww->buycnt}}</span>
                         <span>
		   				@if($row->status == 0)
		   				未收货
		   				@else
		   				已收货
		   				<a href="{{url('/home/good/list')}}/{{$ww->gid->gid}}" style="color: silver;">去评论商品</a>
		   				@endif
		   			</span>
		   		</div>

		   		
		   	</div>
		   	@endforeach
		   	<div class="col-md-6 register-bottom-grid" style="height: 80%;padding: 0 0 0 0;position: absolute;left:570px;top: 51px;border-left: 1px solid silver;">
		   		<div class="col-md-3 register-bottom-grid" style="height: 100px;padding: 0 0 0 0;text-align: center;line-height: 100px;">
		   			<span>收货人：{{$row->rec}}</span>
		   		</div>
		   		<div class="col-md-3 register-bottom-grid" style="height: 100px;padding: 0 0 0 0;text-align: center;line-height: 100px;">
 		   			<span>总额：{{$row->ormb}}</span>		   			
		   		</div>
		   		<div class="col-md-3 register-bottom-grid" style="height: 100px;padding: 0 0 0 0;text-align: center;line-height: 100px;">
		   			<span>
		   				@if($row->status == 0)
		   				未收货
		   				@else
		   				已收货
		   				
		   				@endif
		   			</span>
		   		</div>
		   		<div class="col-md-3 register-bottom-grid" style="height: 50px;padding: 0 0 0 0;text-align: center;line-height: 50px;">
		   			<span><a style="color: silver;" href="{{url('/home/index/status')}}/{{$ww->oid}}">确认收货</a></span>
		   			<span><a style="color: silver;" href="{{url('/home/index/delete')}}/{{$ww->oid}}">删除订单</a></span>
		   		</div>
		   		
		   	</div>
		   	<div class="col-md-12 register-bottom-grid" style="background:rgb(245,245,245); height: 50px;margin: 0 0 0 0 ;line-height: 50px;">
		   		
		   	</div>
		   </div>
		   @endforeach
</div>
<script>
	 $('.edit').fadeOut(2000);

		var one = document.getElementById('one');
		var two = document.getElementById('two');
		var ones = ['北京','河南','河北'];
		var twos = [];
		twos['北京'] = ['昌平','朝阳','石景山'];
		twos['河南'] = ['鹤壁','安阳','周口'];
		twos['河北'] = ['唐山','石家庄','张家口'];
		var onestr = '';
		for(var i = 0; i < ones.length; i ++)
        {
            onestr += "<option name='one' value="+ ones[i] +">" + ones[i] + "</option>";

        }
        one.innerHTML = onestr;
        init();
        function init()
        {
        	var onev = one.value;
        	var twoarr = twos[onev];
        	var twostr = '';
        	for(var j=0;j<twoarr.length;j++)
        	{
        		twostr += "<option name='ww' value="+ twoarr[j] +">" + twoarr[j] + "</option>";
        	}
        	two.innerHTML = twostr;
        }
       one.onchange = function()
       {
       	init();
       }

</script>

<!--//content-->
@endsection